<template>
  <div class="scoreAll">
    <div class="basicInfo">
      <div style="flex: 1.5;">
        <span>
          赛事名称：
          <b>{{ platoonMatch.com_name }}</b>
        </span>
        <span>
          裁判长：
          <b>{{ platoonMatch.referee_name }}</b>
        </span>
      </div>
      <div style="flex: 2;display: flex;justify-content: flex-end;align-items: baseline;">
        <span class="countScene">{{ countScene }}场</span>
        <div class="date">
          <el-select v-model="date" size="small" placeholder="请选择时间" @change="change" style="width:150px;">
            <el-option v-for="(item, index) in platoonList.date" :key="index" :label="item" :value="item"></el-option>
          </el-select>
        </div>
        <div class="btnGroup">

          <a style="margin-right: 10px;width: 80%;margin-bottom: 20px;" :href="WarTableUrl" download="离会信息">
            <el-button type="primary" size="medium"  class="goMatchForm"  :loading="loadingWarTab" @click="uploadTabInfo">导出离会信息</el-button>
          </a>

          <a style="width: 80%;margin-bottom: 20px;" :href="platoonUrl" download="排战表">
            <el-button type="primary" size="medium" class="goMatchForm" :loading="loadingWar" @click="uploadInfo">导出信息</el-button>
          </a>
          <!-- <el-button type="danger" @click="downloadInfo">淘汰人员名单</el-button> -->
          <el-button type="primary" size="medium" @click="toRelease" style="margin-left: 10px;">发布</el-button>
          <el-button type="info" plain size="medium" @click="goback">返回</el-button>
        </div>
      </div>
    </div>
    <div class="tableBox" v-loading="loading">
      <div class="tableMain" v-loading="loading">
        <el-scrollbar style="height: 780px;width: 95vw; box-shadow: 1px 0px 9px 2px #9999;" wrap-class="tableScorll" :native="true">
          <table class="fixed_headers" style="">
            <thead>
              <tr>
                <th>场序</th>
                <th v-for="(ground, groundIndex) in platoonName" :key="groundIndex">{{ ground.ground_name }}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="(playNumList, GroundIndex) in platoonGrounds" :key="GroundIndex">
                <td style="vertical-align: middle;text-align: center;">
                  <div class="groundIndex">{{ GroundIndex + 1 }}</div>
                </td>
                <td v-for="(playerNum, playerIndex) in playNumList" :key="`${playerIndex}a`">
                  <div class="panel__body--list--playground">
                    <div v-for="(element, elementIndex) in playerNum.list" :key="`${elementIndex}b`" class="panel__body--item--playground">
                      <!-- :class="dragDisabled(playNumList[playerIndex].list[0]) ? 'publishBattleBox' : ''" -->
                      <!-- :style="{ background: signColor(playNumList[playerIndex].list[0]), position: relative}" -->
                      <div style="position: relative" class="battleBox" v-if="elementIndex < 1 && element" :class="{publishBattleBox : dragDisabled(playNumList[playerIndex].list[0])}">
                        <div class="customColor" :style="{ background: signColor(playNumList[playerIndex].list[0])}"></div>
                        <div style="display: flex;justify-content: space-between;align-items: baseline;">
                          <el-input v-if="GroundIndex == 0" v-model="element.note" size="mini" :disabled="dragDisabled(playNumList[playerIndex].list[0])"
                            style="width: 83%;margin: 0 1%;" placeholder="开始时间"></el-input>
                          <el-input v-else v-model="element.note" size="mini" :disabled="dragDisabled(playNumList[playerIndex].list[0])"
                            style="width: 83%;margin: 0 1%;color: #666" placeholder="紧跟前场">紧跟前场</el-input>
                          <div style="margin-right: 5px;color: #666666">#{{ GroundIndex + 1 }}</div>
                        </div>
                        <!--一盘 1场 三盘 3场 五盘 5场-->
                        <div class="playerName" @click.stop="
                            dragDisabled(playNumList[playerIndex].list[0])
                              ? showScore(element, elementIndex, playerIndex, GroundIndex)
                              : editPlayer(element, elementIndex, playerIndex, GroundIndex)
                          ">
                          <div :class="element.name_a == element.win_site ? 'winner' : element.a_status == 1 ? 'red' : ''">
                            <span v-if="element.team_name_a">
                              <span v-if="element.type == 2">{{ element.site_a }}</span>
                              {{ element.team_name_a }}
                            </span>
                            <span v-else>{{ element | playerName('a') }}</span>
                          </div>
                          <div class="vsGround">
                            <div class="VS">VS</div>
                            <div class="numBox" v-for="(game, gameIndex) in element.score" :key="gameIndex" v-if="gameIndex < 4">
                              <div class="numTop">
                                <div style="display: flex;">
                                  <div style="width:50%;text-align: right;">{{ game.top }}</div>
                                  <div style="font-size: 8px;position: relative;transform: scale(0.9, 0.9);width: 50%;text-align: left;"
                                    v-if="game.top < game.bot">{{ game.tiebreak }}</div>
                                </div>
                              </div>
                              <div>
                                <div style="display: flex;">
                                  <div style="width:50%;text-align: right;">{{ game.bot }}</div>
                                  <div style="font-size: 8px;position: relative;transform: scale(0.9, 0.9);width: 50%;text-align: left;"
                                    v-if="game.top > game.bot">{{ game.tiebreak }}</div>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div style="border-bottom: 1px dashed #6666;" :class="element.name_b == element.win_site ? 'winner' : element.b_status == 1 ? 'red' : ''">
                            <span v-if="element.team_name_b">
                              <span v-if="element.type == 2">{{ element.site_b }}</span>
                              {{ element.team_name_b }}
                            </span>
                            <span v-else>{{ element | playerName('b') }}</span>
                          </div>
                        </div>
                        <div class="playerInfo" @click.stop="dragDisabled(playNumList[playerIndex].list[0]) ? '' : editPlayer(element, elementIndex, playerIndex, GroundIndex)">
                          <!-- 轮次名称 time 2020-1-6 16:40:31-->
                          <div>{{element.group_name}}</div>
                          <div v-if="element.com_system_type == 5">{{ element.second_order + 1 }}区 {{ element | wheelName }}</div>
                          <div v-else>
                            {{ element | wheelName }}
                          </div>
                          <div>
														<!-- 非团体 -->
                            <el-button style="padding: 1px 2px;" type="danger" size="mini" plain v-if="element.status == 2 && element.team_name_a == null && platoonMatch.status != 5"
                              @click="rescoring(element.id, playerIndex)">更正比分</el-button>
															
                          </div>
                          <div style="display: flex;justify-content: space-between;align-items: baseline;margin: 0 10%;">
                            <div style="text-align: left;" v-if="element.referee">{{ element.referee }}</div>
                            <div style="text-align: left;" v-if="element.match_time">{{ element.match_time }}</div>
                          </div>
                          <div style="text-align: left;margin-left: 5px;"></div>
                        </div>
                      </div>
                    </div>
                  </div>
                </td>
              </tr>
            </tbody>
          </table>
        </el-scrollbar>
      </div>
    </div>
    <!-- 单双打 -->
    <el-dialog :title="dialogElement.roundsName" :visible.sync="outerDialog" class="dialog" width="530px" v-if="outerDialog">
      <div style="display: flex;flex-direction: row;justify-content: space-between;">
        <div class="leftBox" style="width:10%">
          <b>分数：</b>
        </div>
        <div class="battleBox" style="width: 80%;">
          <div class="playerName" style="position: relative;">
            <div class="vsGround">
              <div class="VS">
                <div :class="winner == 0 ? 'winner' : ''" style="width: 110px;">
                  <span v-if="dialogElement.team_name_a">{{ dialogElement.team_name_a }}</span>
                  <span v-else>{{ dialogElement | playerName('a', 1) }}</span>
                  <span v-if="winner == 0">胜者</span>
                  <span v-if="winner == 1">败者</span>
                </div>
                <span style="text-align: center">VS</span>
                <div :class="winner == 1 ? 'winner' : ''" style="width: 110px;">
                  <span v-if="dialogElement.team_name_b">{{ dialogElement.team_name_b }}</span>
                  <span v-else>{{ dialogElement | playerName('b', 1) }}</span>
                  <span v-if="winner == 1">胜者</span>
                  <span v-if="winner == 0">败者</span>
                </div>
              </div>
              <div class="numBox" v-for="(game, index) in dialogElement.score" :key="index" v-if="index < 4">
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" class="numTop" v-model="game.top"
                  style="min-width: 65px;" @input="handleInput(game.top, index, 'top')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" class="numBottom" v-model="game.bot"
                  style="min-width: 65px;" @input="handleInput(game.top, index, 'bot')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" v-model="game.tiebreak" style="min-width:65px;margin-bottom: 10px;"
                  @input="handleInput(game.top, index, 'tiebreak')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
              </div>
            </div>
            <div style="position: absolute;top: 60px;left: 4px;">抢七负方分数</div>
						
          </div>
          <div class="playerInfo">
            <div v-if="dialogElement.group_name">{{ dialogElement.group_name }}</div>
            <div v-if="dialogElement.com_system_type != 3 && dialogElement.com_system_type != 5">第{{ dialogElement.stage }}阶段
              <span v-if="dialogElement.stage == 1">第{{ dialogElement.wheel }}轮</span>
              <span v-if="dialogElement.stage == 2">{{ dialogElement | wheelName }}</span>
            </div>
            <div v-else-if="dialogElement.com_system_type == 5">{{ dialogElement.second_order + 1 }}区 {{ dialogElement | wheelName }}</div>
            <div v-else>{{ dialogElement | wheelName }}</div>
          </div>
        </div>
        <div class="btnGroup">
          <el-button type="info" size="mini" style="margin: 0 0 2px 10px;" @click="giveUp(0)">弃权</el-button>
          <el-button type="info" size="mini" @click="giveUp(1)">弃权</el-button>
					<div style="width:50px; font-size: 14px;border-radius: 10px;border: 1px red solid;margin: 10px;color: red;font-size: 10px;line-height: 1;padding: 1px 2px;"
						  @click="setEyeSingle(index)">鹰眼次数</div>
        </div>
      </div>
      <div style="display: flex;flex-direction: row;margin-top: 10px;height: 100px;">
        <div class="leftBox" style="width:20%">
          <b>时间：</b>
        </div>
        <div class="battleBox" style="width:60%">
          <div style="margin-bottom: 10px;">请输入比赛用时</div>
          <el-input size="small" v-model="match_time" style="width: 50%;"></el-input>
        </div>
      </div>
      <div style="display: flex;flex-direction: row;margin-top: 10px;height: 100px;">
        <div class="leftBox" style="width:20%">
          <b>裁判：</b>
        </div>
        <div class="battleBox" style="width: 60%;">
          <div style="margin-bottom: 10px;">请输入裁判员手机号或姓名进行选择</div>
          <el-select style="width: 50%;" v-model="dialogElement.refreeSearch" filterable remote reserve-keyword size="small"
            placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
            <el-option v-for="item in refreeOption" :key="item.id" :label="item.name" :value="item.id"></el-option>
          </el-select>
        </div>
      </div>
      <el-dialog title="确认胜者" :visible.sync="innerDialog" append-to-body class="dialog" width="20%" style="margin-top: 14%;">
        <el-radio v-model="radioWinner" label="0">
          <span v-if="dialogElement.team_name_a">{{ dialogElement.team_name_a }}</span>
          <span v-else>{{ dialogElement.name_a }}</span>
        </el-radio>
        <el-radio v-model="radioWinner" label="1">
          <span v-if="dialogElement.team_name_b">{{ dialogElement.team_name_b }}</span>
          <span v-else>{{ dialogElement.name_b }}</span>
        </el-radio>
        <div slot="footer" class="dialog-footer">
          <el-button @click="innerDialog = false">取 消</el-button>
          <el-button type="primary" @click="confirmWinner">确 定</el-button>
        </div>
      </el-dialog>
      <el-dialog title="弃权原因" :visible.sync="giveUpDialog" append-to-body class="dialog" width="20%" style="margin-top: 14%;">
        <el-radio v-model="giveUpReason" label="0">因伤弃权</el-radio>
        <el-radio v-model="giveUpReason" label="1">无故弃权</el-radio>
        <div slot="footer" class="dialog-footer">
          <el-button @click="cancelGiveUp">取 消</el-button>
          <el-button type="primary" @click="confirmGiveUper">确 定</el-button>
        </div>
      </el-dialog>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelScore">取 消</el-button>
        <el-button type="primary" @click="confirmScore">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 团体打分 -->
    <el-dialog :title="ground_name + '-第' + dialogElement.place.split(',')[0] + '场序 最大场次：' + team_field_max + '场'"
      :visible.sync="teamDialog" class="dialog" width="1020px" v-if="teamDialog">
      <div style="border-bottom: 1px #ccc solid;" v-for="(dialogElement, index) in templateElement" :key="index">
        <div class="playerInfo" style="display: flex;align-items: center;margin-bottom: 10px;margin-top: 10px;">
          <div v-if="dialogElement.group_name">{{ index + 1 }}、{{ dialogElement.group_name }}</div>
          <div v-if="dialogElement.com_system_type != 3">第{{ dialogElement.stage }}阶段 第{{ dialogElement.wheel }}轮-</div>
          <div v-else>{{ dialogElement | wheelName }}</div>
          <div>{{ dialogElement.place.indexOf(',') == -1 ? dialogElement.place : '后台打分' }}</div>
          <div style="font-size: 14px;border-radius: 10px;border: 1px red solid;margin-left: 20px;color: red;font-size: 10px;line-height: 1;padding: 1px 2px;"
            @click="delTemplate(index, dialogElement.id, dialogElement.pid)" v-if="(dialogElement.status == 2 || dialogElement.status == 3) && platoonMatch.status != 5">更正比分</div>
					<div style="font-size: 14px;border-radius: 10px;border: 1px red solid;margin-left: 20px;color: red;font-size: 10px;line-height: 1;padding: 1px 2px;"
						  @click="setEye(index)" v-if="(dialogElement.status == 2 || dialogElement.status == 3) && platoonMatch.status != 5">鹰眼次数</div>
        </div>
        <!-- 打分 -->
        <div style="display: flex;flex-direction: row;">
          <b>分数：</b>
          <!-- teamA -->
          <div style="display: flex;flex-direction: row;">
            <div style="margin-right: 10px;">{{ dialogElement.site_a }}{{ dialogElement.team_name_a }}</div>
            <el-checkbox-group v-model="checkedteamNameA[index]" @change="teamNameAChange" :max="2" v-if="dialogElement.decisive == 0">
              <el-checkbox v-for="teamName in teamAllName_a" :label="teamName" :key="teamName.userId">{{ teamName.lable }}</el-checkbox>
            </el-checkbox-group>
            <div v-if="dialogElement.decisive == 1 || dialogElement.decisive == 2">{{ dialogElement.name_a }}</div>
          </div>
        </div>
        <!-- 打分输入框 -->
        <div class="battleBox" style="width: 80%;">
          <div class="playerName" style="display: flex;margin-left: 42px;margin-top: 20px;align-items: flex-start;">
            <div class="vsGround">
              <div class="VS" v-if="dialogElement.decisive == 0 || dialogElement.decisive == 2">
                <div :class="dialogElement.winner == 0 ? 'winner' : ''" style="width: 100px;">
                  <span v-if="dialogElement.winner == 0">胜者</span>
                  <span v-if="dialogElement.winner == 1">败者</span>
                </div>
                <span style="text-align: center">VS</span>
                <div :class="dialogElement.winner == 1 ? 'winner' : ''" style="width: 100px;">
                  <span v-if="dialogElement.winner == 1">胜者</span>
                  <span v-if="dialogElement.winner == 0">败者</span>
                </div>
              </div>
              <div class="VS" v-if="dialogElement.decisive == 1">
                <div :class="dialogElement.sign_id_a == dialogElement.winner_id ? 'winner' : ''" style="width: 100px;">
                  <span v-if="dialogElement.sign_id_b">{{ dialogElement.sign_id_a == dialogElement.winner_id ? '胜者' : '败者' }}</span>
                </div>
                <span style="text-align: center">VS</span>
                <div :class="dialogElement.sign_id_b == dialogElement.winner_id ? 'winner' : ''" style="width: 100px;">
                  <span>{{ dialogElement.sign_id_b == dialogElement.winner_id ? '胜者' : '败者' }}</span>
                </div>
              </div>
              <div class="numBox" v-for="(game, indexs) in dialogElement.score" :key="indexs" v-if="indexs < 4">
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" class="numTop" v-model="game.top"
                  style="min-width: 65px;height: auto;" @input="handleInput(game.top, indexs, 'top')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" class="numBottom" v-model="game.bot"
                  style="min-width: 65px;" @input="handleInput(game.top, indexs, 'bot')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
                <el-input size="mini" min="0" max="99" type="number" maxlength="2" v-model="game.tiebreak" style="min-width:65px;margin-bottom: 10px;"
                  @input="handleInput(game.top, indexs, 'tiebreak')" onafterpaste="if(this.value.length==1){this.value=this.value.replace(/[^1-9]/g,'')}else{this.value=this.value.replace(/\D/g,'')}"></el-input>
              </div>
              <div class="btnGroup" style="height: auto;" v-if="dialogElement.decisive == 0 || dialogElement.decisive == 2">
                <el-button type="info" size="mini" style="margin: 0 0 2px 10px;" @click="teamPlayerGiveUp(0, index, dialogElement.decisive)">弃权</el-button>
                <el-button type="info" size="mini" @click="teamPlayerGiveUp(1, index, dialogElement.decisive)">弃权</el-button>
              </div>
            </div>
          </div>
        </div>

        <!-- teamB -->
        <div style="display: flex;flex-direction: row;margin-left: 42px;">
          <div style="margin-right: 10px;">{{ dialogElement.site_b }}{{ dialogElement.team_name_b }}</div>
          <el-checkbox-group v-model="checkedteamNameB[index]" @change="teamNameBChange" :max="2" v-if="dialogElement.decisive == 0">
            <el-checkbox v-for="teamName in teamAllName_b" :label="teamName" :key="teamName.userId">{{ teamName.lable }}</el-checkbox>
          </el-checkbox-group>
          <div v-if="dialogElement.decisive == 1 || dialogElement.decisive == 2">{{ dialogElement.name_b }}</div>
        </div>
        <!-- 选择时间和裁判 -->
        <div style="display: flex;margin-top: 20px;">
          <div style="display: flex;flex-direction: row;height: 50px;">
            <div class="leftBox" style="width:20%">
              <b>时间：</b>
            </div>
            <div class="battleBox" style="width:60%">
              <el-input type="text" size="small" v-model="dialogElement.match_time" style="width: 100%;"></el-input>
            </div>
          </div>
          <div style="display: flex;flex-direction: row;height: 50px;">
            <div class="leftBox" style="width:20%">
              <b>裁判：</b>
            </div>
            <div class="battleBox" style="width: 60%;">
              <el-select style="width: 100%;" v-model="dialogElement.referee" filterable remote reserve-keyword size="small"
                placeholder="请输入关键词" :remote-method="remoteMethod" :loading="loading">
                <el-option v-for="item in refreeOption" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </div>
          </div>
          <div>
            <el-button size="small" type="primary" @click="confirmWinnerBtn(index)" v-if="dialogElement.decisive == 0">确认胜者</el-button>
            <el-button size="small" type="primary" @click="confirmWinnerBtnTow(index)" v-if="dialogElement.decisive == 2">确认胜者</el-button>
          </div>
          <div style="margin-left: 45px;">
            <el-button size="small" type="primary" @click="addTeamInfo(index)" v-if="mask != 1 && index == templateElement.length - 1 && index + 1 != team_field_max">添加</el-button>
          </div>
        </div>

        <!-- 确认胜者 -->
        <el-dialog title="确认胜者" :visible.sync="confirmWinnerDialog" append-to-body class="dialog" width="20%" style="margin-top: 14%;">
          <span style="margin-right: 20px;">
            <el-radio v-model="winnerRadio" label="0">
              <span v-if="dialogElement.team_name_a">{{ playerA.join(',') }}</span>
            </el-radio>
          </span>
          <el-radio v-model="winnerRadio" label="1">
            <span v-if="dialogElement.team_name_b">{{ playerB.join(',') }}</span>
          </el-radio>
          <div slot="footer" class="dialog-footer">
            <el-button @click="confirmWinnerDialog = false">取 消</el-button>
            <el-button type="primary" @click="confirmTeamWinner(index)">确 定</el-button>
            <!--@click="confirmWinner"-->
          </div>
        </el-dialog>

        <!-- 弃权 -->
        <el-dialog title="弃权原因" :visible.sync="giveUpDialog" append-to-body class="dialog" width="30%" style="margin-top: 14%;">
          <el-radio v-model="giveUpReason" label="0">因伤弃权</el-radio>
          <el-radio v-model="giveUpReason" label="1">无故弃权</el-radio>
          <div slot="footer" class="dialog-footer">
            <el-button @click="cancelGiveUp">取 消</el-button>
            <el-button type="primary" @click="confirmPlayerGiveUper(index)">确 定</el-button>
            <!--@click="confirmWinner"-->
          </div>
        </el-dialog>
      </div>
      <!-- 确定按钮 -->
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancelTeamScore">取消</el-button>
        <el-button type="primary" @click="confirmTeamScore">确定</el-button>
        <!--@click="confirmScore"-->
      </div>
    </el-dialog>
		<!-- 团体鹰眼编辑 -->
		<el-dialog title="修改鹰眼" :visible.sync="showEye"  :center="true">
			<div style="margin-top: 20px;" v-if="templateElement[curindex]">
				<span class="team_name" style="margin-right:20px;width:100px;height:40px;display:inline-block;" v-if="templateElement[curindex]">{{templateElement[curindex].name_a}}</span>
					<el-input-number v-model="eye_a" :min="0" :max="4" label="鹰眼A"></el-input-number>
				<br>
				<span class="team_name" style="margin-right:20px;width:100px;height:40px;display:inline-block;" v-if="templateElement[curindex]">{{templateElement[curindex].name_b}}</span>
				<el-input-number v-model="eye_b" :min="0" :max="4" label="鹰眼B"></el-input-number>
			</div>
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="showEye = false">取 消</el-button>
		    <el-button type="primary" @click="submitEye">确 定</el-button>
		  </div>
		</el-dialog>
		<!-- 单双打鹰眼编辑 -->
		<el-dialog title="修改鹰眼" :visible.sync="showEye"  :center="true">
			<div style="margin-top: 20px;" v-if="dialogElement">
				<span class="team_name" style="margin-right:20px;width:100px;height:40px;display:inline-block;"></span>
				{{dialogElement.team_name_a||dialogElement.name_a}}<el-input-number v-model="eye_a" :min="0" :max="4" label="鹰眼A"></el-input-number>
				<br>
				<span class="team_name" style="margin-right:20px;width:100px;height:40px;display:inline-block;"></span>
				{{dialogElement.team_name_b||dialogElement.name_b}}<el-input-number v-model="eye_b" :min="0" :max="4" label="鹰眼B"></el-input-number>
			</div>
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="showEye = false">取 消</el-button>
		    <el-button type="primary" @click="submitEyeSingle(dialogElement.id)">确 定</el-button>
		  </div>
		</el-dialog>
    <!-- 团体打分结束 -->
    <el-dialog title="比赛结果录入失败" :visible.sync="forbiddenDialog" width="30%" style="margin-top: 10%">
      <span>上一轮（{{ forbiddenDialogName }}）尚未结束，无法进行成绩录入</span>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="forbiddenDialog = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
  import {
    mapState
  } from "vuex";
  import schedule from "@/utils/schedule.js";
  import customColorArr from "@/utils/customColor.js";
  export default {
    data() {
      return {
        rankList: [],
				isactive:false,
				curindex:0,
        date: "",
        dialogElement: {},
        winner: -1,
        giveUper: 0,
        giveUpReason: -1,
        outerDialog: false,
        innerDialog: false,
        giveUpDialog: false,
        editPlayerIndex: "",
        editGroundIndex: "",
        refreeSearch: "",
        match_time: "",
        refreeOption: [],
        loading: true,
        forbiddenDialog: false,
        forbiddenDialogName: "",
        teamDialog: false,
        checkedteamNameA: [],
        checkedteamNameB: [],
        confirmWinnerDialog: false,
        winnerRadio: -1,
        template: [],
        templateElement: [],
        element: null,
        index: 0,
        playerA: [],
        playerAId: [],
        playerB: [],
        playerBId: [],
        templateAll: [],
        team_field: "",
        platoon_id: "",
        decisive: "",
        dialogElementAfter: [],
        mask: "",
        radioWinner: null,
        countScene: 0,
        loadingWar: false,
        loadingWarTab: false,
        confirmWinnerStatus: false,
        record: "",
        records: "",
        team_field_max: "",
        ground_name: "",
        getTabArr: [],
				showEye:false,
        eye_a:'0',
        eye_b:'0'
      };
    },
    created() {
      this.initialization(""); //初始化
    },
    filters: {
      playerName: (battle, type, scoreDialog) => {
        return schedule.Name(battle, type, scoreDialog);
      },
      wheelName: battle => {
        return battle.wheel_name
        // return schedule.wheelName(battle);
      }
    },
    computed: {
      ...mapState({
        platoonMatch: "platoonMatch",
        platoonInfo: "platoonInfo",
        platoonGrounds: "platoonGrounds",
        platoonName: "platoonName",
        platoonDate: "platoonDate",
        platoonList: "platoonList",
        roundsSelected: "roundsSelected"
      }),
       WarTableUrl() {
        // api/v1/WarTable/export_blank?com_id=&match_date=2020-04-10
        let url = this.$axios.defaults.baseURL + '/WarTable/export_blank?com_id=' + this.$route.query.MatchId + '&match_date=' + this.date
        return url;
      },
      platoonUrl() {
        let platoonGrounds_id = this.$route.query.MatchId;
        return (
          this.$axios.defaults.baseURL +
          "/war_table/execl_demo?com_id=" +
          platoonGrounds_id +
          "&match_date=" +
          this.date
        );
      },
      dragDisabled() {
        return function(item) {
          if (!item) return false;
          return item.status == 2 || item.status == 0 ? true : false;
        };
      },
      //区分项目组别颜色
      signColor() {
        return function(item) {
          return this.getCurrentProject(item.group_id);
        };
      },
      // 新增
      teamAllName_a() {
        let teamuserid = [];
        let arr = this.dialogElement.name_a.split(",");
        let arr1 = this.dialogElement.user_id_a.split(",");
        for (var i = 0; i < arr.length; i++) {
          teamuserid.push({
            userId: arr1[i],
            lable: arr[i]
          });
        }
        return teamuserid;
      },
      teamAllName_b() {
        let teamuserid = [];
        let arr = this.dialogElement.name_b.split(",");
        let arr1 = this.dialogElement.user_id_b.split(",");
        for (var i = 0; i < arr.length; i++) {
          teamuserid.push({
            userId: arr1[i],
            lable: arr[i]
          });
        }
        return teamuserid;
      }
    },
    watch: {
      platoonDate(val) {},
      platoonMatch(val) {},
      platoonInfo(val) {},
      date(val) {}
    },
    methods: {
      //获取随机颜色
      getRandomColor() {
        return (
          "#" +
          ("00000" + ((Math.random() * 0x1000000) << 0).toString(16)).slice(-6)
        );
      },
      // 获取当前group_id数组下标
      getCurrentProject(group_id) {
        let getTabArr_l = this.getTabArr.length;
        for (let index = 0; index < getTabArr_l; index++) {
          const element = this.getTabArr[index];
          if (element.project_id == group_id) {
            return element.color;
          }
        }
      },
      getProject_id() {
        let getTabArr = [];
        for (const s in this.platoonMatch) {
          if (
            Object.prototype.toString.call(this.platoonMatch[s]) ===
            "[object Object]"
          ) {
            getTabArr.push({
              project_id: this.platoonMatch[s].project_id,
              color: customColorArr[s] ?
                customColorArr[s] :
                this.getRandomColor()
            });
          }
        }
        this.getTabArr = getTabArr;
      },
      rescoring(id, playerIndex) {
        this.$confirm("确定更正本场比赛结果?", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          })
          .then(() => {
            this.loading = true;
            this.$axios
              .post(
                "/Platoon/once_more_score", {
                  id: id
                }, {
                  headers: {
                    token: window.sessionStorage.getItem("token")
                  }
                }
              )
              .then(res => {
                if (res.data.code == 2000) {
                  this.loading = false;
									setTimeout(()=>{
										console.log('触发')
										this.isactive = true
									},500)
                  this.$message({
                    message: res.data.msg,
                    type: "success"
                  });
                  this.initialization();
                } else {
                  this.$message({
                    message: res.data.msg,
                    type: "error"
                  });
                }
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "您已取消"
            });
          });
      },
      uploadInfo() {
        this.loadingWar = true;
        setTimeout(() => {
          this.loadingWar = false;
        }, 800);
      },
      uploadTabInfo() {
        this.loadingWarTab = true;
        setTimeout(() => {
          this.loadingWarTab = false;
        }, 800);
      },
      downloadInfo(){
        let com_id = this.$route.query.MatchId
        let match_date = this.date
        console.log(com_id,match_date)
        this.$axios.post('/war_table/export_blank',{com_id:com_id,match_date:match_date})
        .then(res=>{
          console.log(res)
        })
      },
      initialization(date) {
        let obj = {};
        obj.com_id = this.$route.query.MatchId;
        obj.isCheckSchedule = false;
        obj.checkSchedule = 1;
        var initializationTable = new Promise((resolve, reject) => {
          this.$store
            .dispatch("getPlatoonInfo", obj)
            .then(() => {
              this.$store
                .dispatch("getPlatoonList", obj)
                .then(() => {
                  resolve();
                })
                .catch(res => {
                  reject(res);
                });
            })
            .catch(res => {
              reject(res);
            });
        });
        initializationTable.then(() => {
          this.date = this.platoonList.time;
          let val = this.date;
          //计算组别个数
          this.getProject_id();
          setTimeout(() => {
            if (this.platoonList.place) {
              this.countScene = this.platoonList.place[this.date].length;
              for (let games in this.platoonList.place[val]) {
                let col = parseInt(this.platoonList.place[val][games].col) - 1;
                let row = parseInt(this.platoonList.place[val][games].row) - 1;
                let groundLenth = this.platoonGrounds.length - 1;
                for (let times = row; times > groundLenth; times--) {
                  schedule.moreField(this.platoonGrounds);
                }
                this.platoonGrounds[row][col].list.push(
                  this.platoonList.place[val][games]
                );
              }
              // schedule.listToPlayGround(this.platoonList.place[this.date], this.platoonGrounds, this.roundsSelected, this.teamsInfo)
              for (let col in this.platoonGrounds) {
                for (let row in this.platoonGrounds[col]) {
                  if (
                    this.platoonGrounds[col][row].list[0] &&
                    !this.platoonGrounds[col][row].list[0].score
                  ) {
                    //1为一盘及平局决胜(抢七)  2为三盘两胜  3为五盘三胜(最新规则已删除  4为两盘及平局决胜(抢十)  5为其他
                    let arr = [];
                    let games = 0;
                    switch (this.platoonGrounds[col][row].list[0].formant) {
                      case 1:
                        games = 2;
                        break;
                      case 2:
                        games = 4;
                        break;
                      case 3:
                        games = 4;
                        break;
                      case 4:
                        games = 4;
                        break;
                      case 5:
                        games = 4;
                        break;
                      case 11:
                        games = 4;
                        break;
                      case 12:
                        games = 4;
                        break;
                    }
                    for (let game = 0; game < games; game++) {
                      arr.push({
                        top: "",
                        bot: "",
                        tiebreak: ""
                      });
                    }
                    this.platoonGrounds[col][row].list[0].score = arr;
                  }
                }
              }
            } else {
              this.countScene = 0;
            }
            this.loading = false;
						setTimeout(()=>{
							console.log('触发2')
							this.isactive = true
						},500)
          }, 100);
        });
        initializationTable.catch(res => {
          this.loading = false;
					setTimeout(()=>{
						console.log('触发3')
						this.isactive = true
					},500)
          this.$message({
            type: "error",
            message: res
          });
        });
        this.$store.commit("setPlatoonDate", this.date);
      },
      change() {
        this.loading = true;
        let obj = {};
        obj.com_id = this.$route.query.MatchId;
        obj.isCheckSchedule = false;
        obj.checkSchedule = 1;
        obj.date = this.date;
        var initializationTable = new Promise((resolve, reject) => {
          this.$store
            .dispatch("getPlatoonInfo", obj)
            .then(() => {
              this.$store
                .dispatch("getPlatoonList", obj)
                .then(() => {
                  resolve();
                })
                .catch(res => {
                  reject(res);
                });
            })
            .catch(res => {
              reject(res);
            });
        });
        initializationTable.then(() => {
          setTimeout(() => {
            if (this.platoonList.place) {
              this.countScene = this.platoonList.place[this.date].length;
              let val = this.date;
              for (let games in this.platoonList.place[val]) {
                let col = parseInt(this.platoonList.place[val][games].col) - 1;
                let row = parseInt(this.platoonList.place[val][games].row) - 1;
                let groundLenth = this.platoonGrounds.length - 1;
                for (let times = row; times > groundLenth; times--) {
                  schedule.moreField(this.platoonGrounds);
                }
                this.platoonGrounds[row][col].list.push(
                  this.platoonList.place[val][games]
                );
              }
              // schedule.listToPlayGround(this.platoonList.place[this.date], this.platoonGrounds, this.roundsSelected, this.teamsInfo)
              for (let col in this.platoonGrounds) {
                for (let row in this.platoonGrounds[col]) {
                  if (
                    this.platoonGrounds[col][row].list[0] &&
                    !this.platoonGrounds[col][row].list[0].score
                  ) {
                    //1为一盘及平局决胜(抢七)  2为三盘两胜  3为五盘三胜(最新规则已删除  4为两盘及平局决胜(抢十)  5为其他
                    let arr = [];
                    let games = 0;
                    switch (this.platoonGrounds[col][row].list[0].formant) {
                      case 1:
                        games = 2;
                        break;
                      case 2:
                        games = 4;
                        break;
                      case 3:
                        games = 4;
                        break;
                      case 4:
                        games = 4;
                        break;
                      case 5:
                        games = 4;
                        break;
                      case 11:
                        games = 4;
                        break;
                      case 12:
                        games = 4;
                        break;
                    }
                    for (let game = 0; game < games; game++) {
                      arr.push({
                        top: "",
                        bot: "",
                        tiebreak: ""
                      });
                    }
                    this.platoonGrounds[col][row].list[0].score = arr;
                  }
                }
              }
            } else {
              this.countScene = 0;
            }
            this.loading = false;
						setTimeout(()=>{
							console.log('触发4')
							this.isactive = true
						},500)
          }, 100);
        });
        initializationTable.catch(res => {
          this.loading = false;
					setTimeout(()=>{
						console.log('触发5')
						this.isactive = true
					},500)
          this.$message({
            type: "error",
            message: res
          });
        });
        this.$store.commit("setPlatoonDate", this.date);
      },
      showScore(element, elementIndex, playerIndex, GroundIndex) {
				console.log('showScore')
				console.log('type='+element.type,'status='+element.status)
        if (element.status == 2 && element.type == 2) {
					console.log('showScore')
          this.editPlayer(element);
          this.mask = 1;
        }
      },
      /**
       * 发送鹰眼数据
       * api/v1/TeamOnce/edit_eyes
        传三个参数，id、eye_a、eye_b
       * 
       */
			setEyeSingle(index){
				// console.log(this.dialogElement)
				this.showEye=true
				this.teamDialog=false
				this.curindex=index
			},
			setEye(index){
				console.log(index)
        console.log(this.templateElement);
				this.showEye=true
        this.teamDialog=false
				this.curindex=index
				// 如果有就渲染
				if(this.templateElement[index].eye_a&&this.templateElement[index].eye_b){
					this.eye_a = this.templateElement[index].eye_a.toString()
					this.eye_b = this.templateElement[index].eye_b.toString()
				}else{
					this.$message.error("初始化鹰眼数据失败!")
				}
      },
			submitEyeSingle(id){
				let params = {}
				params.id=id,
				params.eye_a=this.eye_a,
				params.eye_b=this.eye_b
				this.$axios.post("TeamOnce/edit_eyes_b",
				{
					params
				},
				{headers:{
                  token: window.sessionStorage.getItem("token")
                }})
				
				.then(res=>{
					console.log(res)
					if(res.data.code==2000){
						this.$message.success(res.data.msg)
						this.showEye=false
						this.eye_a='0'
						this.eye_b='0'
					}else{
						this.$message.error(res.data.msg)
					}
				})
			},
      submitEye(){
				console.log('submitEye')
        let params = {}
        let id= this.templateElement[this.curindex].id.toString()
        let eye_a= this.eye_a
        let eye_b= this.eye_b
        params.id=id
        params.eye_a=eye_a
        params.eye_b=eye_b
				console.log(params)
        this.$axios.post('TeamOnce/edit_eyes',{params}, {
                headers: {
                  token: window.sessionStorage.getItem("token")
                }
              })
        .then(res=>{
          console.log(res.data.data)
          if(res.data.code!=2000){
            this.$message({
              type: "error",
              message: res.data.msg
            });
						return
          }
					this.$message({
					  type: "success",
					  message: res.data.msg
					});
          this.showEye=false
					this.eye_a='0'
					this.eye_b='0'
          console.log(this.templateElement[this.curindex].id,this.eye_a,this.eye_b)
        })
        .catch(err=>{
          console.log(err)
        })
      },
      editPlayer(element, elementIndex, playerIndex, GroundIndex) {
				console.log('editPlayer')
				console.log('type='+element.type,'status='+element.status)
				// element.type = 0
        if (element.type == 0 || element.type == 1) {
          this.winner = -1;
          this.radioWinner = -1;
          if (
            element.name_a.indexOf("胜者") != -1 ||
            element.sign_id_a == null ||
            element.sign_id_a == ""
          ) {
            this.forbiddenDialogName =
              element.name_a.split(",")[0] +
              "-" +
              element.name_a.split(",")[element.name_a.split(",").length - 1];
            return (this.forbiddenDialog = true);
          }
          if (
            element.name_b.indexOf("胜者") != -1 ||
            element.sign_id_b == null ||
            element.sign_id_b == ""
          ) {
            this.forbiddenDialogName =
              element.name_b.split(",")[0] +
              "-" +
              element.name_b.split(",")[element.name_b.split(",").length - 1];
            return (this.forbiddenDialog = true);
          }
          this.dialogElement = JSON.parse(JSON.stringify(element));
          this.editPlayerIndex = playerIndex;
          this.editGroundIndex = GroundIndex;
          this.outerDialog = true;
					this.$axios.post("TeamOnce/edit_eyes_b",{id:element.id})
        }
        if (element.type == 2) {
          this.mask = 0;
          this.editPlayerIndex = playerIndex;
          this.editGroundIndex = GroundIndex;
          this.team_field = element.team_field;
          this.platoon_id = element.id;
          this.$axios
            .post(
              "/TeamScore/index", {
                id: element.id
              }, {
                headers: {
                  token: window.sessionStorage.getItem("token")
                }
              }
            )
            .then(res => {
							console.log(res)
              if (res.data.code == 2000) {
                this.team_field_max = res.data.data.team_field_max;
                this.ground_name = res.data.data.ground_name;
                this.confirmWinnerStatus = false;
                this.teamDialog = true;
                let name_a = [];
                let name_b = [];
                for (
                  var i = 0; i < res.data.data.team_member.team_a.length; i++
                ) {
                  name_a.push(res.data.data.team_member.team_a[i].name);
                }
                for (
                  var i = 0; i < res.data.data.team_member.team_b.length; i++
                ) {
                  name_b.push(res.data.data.team_member.team_b[i].name);
                }
                localStorage.setItem("name_a", name_a.join(","));
                localStorage.setItem("name_b", name_b.join(","));
                if (res.data.data.team_platoon.length == 0) {
                  this.index = 0;
                  this.templateElement = [];
                  this.checkedteamNameA = [];
                  this.checkedteamNameB = [];
                  this.winner = -1;
                  this.dialogElement = JSON.parse(JSON.stringify(element));
                  element.decisive = 0;
                  this.element = JSON.parse(JSON.stringify(element));
                  this.templateElement.push(element);
                  for (let key in this.templateElement) {
                    this.$set(this.checkedteamNameA, key, []);
                    this.$set(this.checkedteamNameB, key, []);
                  }
                } else {
                  this.index = res.data.data.team_platoon.length - 1;
                  this.templateElement = [];
                  this.dialogElement = JSON.parse(JSON.stringify(element));
                  this.element = JSON.parse(JSON.stringify(element));
                  element.decisive = 0;
                  // this.winner = 0
                  for (var i = 0; i < res.data.data.team_platoon.length; i++) {
                    let arr = [];
                    let games = 0;
                    switch (res.data.data.team_platoon[i].formant) {
                      case 1:
                        games = 2;
                        break;
                      case 2:
                        games = 4;
                        break;
                      case 3:
                        games = 4;
                        break;
                      case 4:
                        games = 4;
                        break;
                      case 5:
                        games = 4;
                        break;
                      case 11:
                        games = 4;
                        break;
                      case 12:
                        games = 4;
                        break;
                      default:
                        games = 3;
                        break;
                    }
                    for (let game = 0; game < games; game++) {
                      arr.push({
                        top: "",
                        bot: "",
                        tiebreak: ""
                      });
                    }
                    let score = res.data.data.team_platoon[i].score ?
                      res.data.data.team_platoon[i].score :
                      arr;
                    if (res.data.data.team_platoon[i].status == 3) {
                      this.checkedteamNameA = [];
                      this.checkedteamNameB = [];
                      this.templateElement[i] = {
                        id: res.data.data.team_platoon[i].id,
                        pid: res.data.data.team_platoon[i].pid,
                        eye_a:res.data.data.team_platoon[i].eye_a,
                        eye_b:res.data.data.team_platoon[i].eye_b,
                        status: res.data.data.team_platoon[i].status,
                        group_name: res.data.data.team_platoon[i].group_name,
                        score: score,
                        match_time: res.data.data.team_platoon[i].match_time,
                        match_date: res.data.data.team_platoon[i].match_date,
                        stage: res.data.data.team_platoon[i].stage,
                        wheel: element.wheel,
                        name_a: res.data.data.team_platoon[i].name_a,
                        name_b: res.data.data.team_platoon[i].name_b,
                        team_name_a: res.data.data.team_platoon[i].team_name_a,
                        team_name_b: res.data.data.team_platoon[i].team_name_b,
                        winner: 1,
                        decisive: 1,
                        sign_id_a: res.data.data.team_platoon[i].sign_id_a,
                        sign_id_b: res.data.data.team_platoon[i].sign_id_b,
                        winner_id: res.data.data.team_platoon[i].winner_id,
                        referee: res.data.data.team_platoon[i].ref_name,
                        referee_id: res.data.data.team_platoon[i].referee,
                        site_a: element.site_a,
                        site_b: element.site_b,
                        place: res.data.data.team_platoon[i].place
                      };
                    } else {
                      this.templateElement[i] = {
                        id: res.data.data.team_platoon[i].id,
                        pid: res.data.data.team_platoon[i].pid,
                        status: res.data.data.team_platoon[i].status,
                        eye_a:res.data.data.team_platoon[i].eye_a,
                        eye_b:res.data.data.team_platoon[i].eye_b,
                        group_name: res.data.data.team_platoon[i].group_name,
                        score: score,
                        match_time: res.data.data.team_platoon[i].match_time,
                        match_date: res.data.data.team_platoon[i].match_date,
                        stage: res.data.data.team_platoon[i].stage,
                        wheel: element.wheel,
                        name_a: res.data.data.team_platoon[i].name_a,
                        name_b: res.data.data.team_platoon[i].name_b,
                        team_name_a: res.data.data.team_platoon[i].team_name_a,
                        team_name_b: res.data.data.team_platoon[i].team_name_b,
                        winner: null,
                        decisive: 2,
                        sign_id_a: res.data.data.team_platoon[i].sign_id_a,
                        sign_id_b: res.data.data.team_platoon[i].sign_id_b,
                        winner_id: res.data.data.team_platoon[i].winner_id,
                        referee: res.data.data.team_platoon[i].ref_name,
                        referee_id: res.data.data.team_platoon[i].referee,
                        site_a: element.site_a,
                        site_b: element.site_b,
                        place: res.data.data.team_platoon[i].place
                      };
                    }
                  }
                }
              }
            });
        }
      },
      teamScoreObg(index) {
        let group_id = this.dialogElement.group_id;
        let group_num = 0;
        let uploadObj = {};
        let winner = {};
        let loser = {};
        for (let i in this.platoonInfo) {
          if (group_id == this.platoonInfo[i].project_id) {
            group_num = this.platoonInfo[i].signUp_num;
          }
        }
        let round = Math.ceil(Math.log(group_num) / Math.LN2);
        uploadObj.is_end = 0;
        if (this.dialogElement.wheel == round) uploadObj.is_end = 1;
        if (this.templateElement[index].winner == 0) {
          winner.user_name = this.playerA.join(",");
          winner.team_name = this.dialogElement.team_name_a;
          winner.user_sign_id = this.dialogElement.sign_id_a;
          winner.user_id = this.playerAId.join(",");
          winner.site = this.dialogElement.site_a;
          winner.seed_num = this.dialogElement.seed_num_a;
          winner.one_limit = this.dialogElement.one_limit_a;
          winner.two_limit = this.dialogElement.two_limit_a;
          winner.three_limit = this.dialogElement.three_limit_a;
          loser.user_name = this.playerB.join(",");
          loser.team_name = this.dialogElement.team_name_b;
          loser.user_sign_id = this.dialogElement.sign_id_b;
          loser.user_id = this.playerBId.join(",");
          loser.site = this.dialogElement.site_b;
          loser.seed_num = this.dialogElement.seed_num_b;
          loser.one_limit = this.dialogElement.one_limit_b;
          loser.two_limit = this.dialogElement.two_limit_b;
          loser.three_limit = this.dialogElement.three_limit_b;
        }
        if (this.templateElement[index].winner == 1) {
          winner.user_name = this.playerB.join(",");
          winner.team_name = this.dialogElement.team_name_b;
          winner.user_sign_id = this.dialogElement.sign_id_b;
          winner.user_id = this.playerBId.join(",");
          winner.site = this.dialogElement.site_b;
          winner.seed_num = this.dialogElement.seed_num_b;
          winner.one_limit = this.dialogElement.one_limit_b;
          winner.two_limit = this.dialogElement.two_limit_b;
          winner.three_limit = this.dialogElement.three_limit_b;
          loser.user_name = this.playerA.join(",");
          loser.team_name = this.dialogElement.team_name_a;
          loser.user_sign_id = this.dialogElement.sign_id_a;
          loser.user_id = this.playerAId.join(",");
          loser.site = this.dialogElement.site_a;
          loser.seed_num = this.dialogElement.seed_num_a;
          loser.one_limit = this.dialogElement.one_limit_a;
          loser.two_limit = this.dialogElement.two_limit_a;
          loser.three_limit = this.dialogElement.three_limit_a;
        }
        uploadObj["win_site"] = winner;
        uploadObj["lose_site"] = loser;
        uploadObj.waiver = {};
        let date = `${this.date} 00:00:00`
        uploadObj.match_date =
          new Date(date).getTime() / 1000;
        uploadObj.match_time = this.templateElement[index].match_time;
        uploadObj.place = this.dialogElement.place;
        uploadObj.group_name = this.dialogElement.group_name;
        uploadObj.stage = this.dialogElement.stage;
        uploadObj.team_field = this.record + 1;
        uploadObj.status = 3;
        uploadObj.name_a = this.playerA.join(",");
        uploadObj.user_id_a = this.playerAId.join(",");
        uploadObj.sign_id_a = this.dialogElement.sign_id_a;
        uploadObj.one_limit_a = this.dialogElement.one_limit_a;
        uploadObj.two_limit_a = this.dialogElement.two_limit_a;
        uploadObj.three_limit_a = this.dialogElement.three_limit_a;
        uploadObj.site_a = this.dialogElement.site_a;
        uploadObj.seed_num_a = this.dialogElement.seed_num_a;
        uploadObj.team_name_a = this.dialogElement.team_name_a;
        uploadObj.name_b = this.playerB.join(",");
        uploadObj.user_id_b = this.playerBId.join(",");
        uploadObj.sign_id_b = this.dialogElement.sign_id_b;
        uploadObj.one_limit_b = this.dialogElement.one_limit_b;
        uploadObj.two_limit_b = this.dialogElement.two_limit_b;
        uploadObj.three_limit_b = this.dialogElement.three_limit_b;
        uploadObj.site_b = this.dialogElement.site_b;
        uploadObj.seed_num_b = this.dialogElement.seed_num_b;
        uploadObj.team_name_b = this.dialogElement.team_name_b;
        (uploadObj.waiver_user = this.giveUper),
        (uploadObj.waiver_cause = parseInt(this.giveUpReason) + 1);
        (uploadObj.platoon_id = this.platoon_id),
        (uploadObj.second_order = this.dialogElement.second_order);
        let score = JSON.parse(
          JSON.stringify(this.templateElement[this.record].score)
        );
        uploadObj.score = score;
        uploadObj.note = this.dialogElement.note;
        uploadObj.stage = this.dialogElement.stage;
        uploadObj.wheel = this.dialogElement.wheel;
        uploadObj.field = this.dialogElement.field;
        uploadObj.group_id = this.dialogElement.group_id;
        uploadObj.com_id = this.$route.query.MatchId;
        uploadObj.referee = this.templateElement[index].referee_id ?
          this.templateElement[index].referee_id :
          this.templateElement[index].referee;
        uploadObj.second_order = this.dialogElement.second_order;
        uploadObj.id = this.templateElement[index].id ?
          this.templateElement[index].id :
          null;
        uploadObj.type =
          this.checkedteamNameA.length == 0 ?
          this.playerA[0].split(",").length :
          this.checkedteamNameA[this.index].length;
        uploadObj.decisive = 0;
        uploadObj.winner = this.winner;
        //问超群
        let fomant = 0;
        switch (this.dialogElement.com_system) {
          case 1:
            fomant = 4;
            break;
          case 2:
            fomant = 2;
            break;
          case 4:
            fomant = 3;
            break;
          case 5:
            fomant = 5;
            break;
          case 11:
            fomant = 4;
            break;
          case 12:
            fomant = 4;
            break;
          default:
            fomant = 3;
            break;
        }
        uploadObj.fomant = fomant;
        uploadObj.is_group = this.dialogElement.isno; //is_group为1的时候是同名次打分，为2是决出1-8名打分
        return uploadObj;
      },
      confirmWinnerBtnTow(index) {
        this.record = index;
        this.confirmWinnerDialog = true;
        this.playerA = [];
        this.playerAId = [];
        this.playerB = [];
        this.playerBId = [];
        this.playerA.push(this.templateElement[index].name_a);
        this.playerAId.push(this.templateElement[index].sign_id_a);
        this.playerB.push(this.templateElement[index].name_b);
        this.playerBId.push(this.templateElement[index].sign_id_b);
      },
      confirmWinnerBtn(index) {
        this.record = index;
        if (
          this.checkedteamNameA[this.index].length == 0 ||
          this.checkedteamNameB[this.index].length == 0
        ) {
          this.$message({
            type: "warning",
            message: "请选择上场人"
          });
        } else if (
          this.checkedteamNameA[this.index].length !=
          this.checkedteamNameB[this.index].length
        ) {
          this.$message({
            type: "warning",
            message: "人数不对等"
          });
        } else if (this.checkedteamNameA[this.index].length > 2) {
          this.$message({
            type: "warning",
            message: "人数不能大于3"
          });
        } else {
          this.confirmWinnerDialog = true;
          this.playerA = [];
          this.playerAId = [];
          this.playerB = [];
          this.playerBId = [];
          for (var i = 0; i < this.checkedteamNameA[this.index].length; i++) {
            this.playerA.push(this.checkedteamNameA[this.index][i].lable);
            this.playerAId.push(this.checkedteamNameA[this.index][i].userId);
          }
          for (var i = 0; i < this.checkedteamNameB[this.index].length; i++) {
            this.playerB.push(this.checkedteamNameB[this.index][i].lable);
            this.playerBId.push(this.checkedteamNameB[this.index][i].userId);
          }
        }
      },
      confirmTeamWinner(index) {
        this.confirmWinnerStatus = true;
        // this.templateAll = []
        if (this.winnerRadio != 1 && this.winnerRadio != 0) {
          this.$message({
            type: "warning",
            message: "请选择本场胜负"
          });
        } else if (!this.checkedScore(this.templateElement[this.record].score)) {
          this.$message({
            type: "warning",
            message: "分数输入有误"
          });
        } else {
          // this.winner = this.winnerRadio
          this.templateElement[this.record].winner = this.winnerRadio;
          // this.templateElement[this.record].winner = this.winnerRadio
          let templateAll = this.teamScoreObg(this.record);
          this.templateAll.push(templateAll);
          this.templateElement[this.record].winner_id =
            templateAll.win_site.user_sign_id;
          this.templateElement[this.record].decisive = 1;
          this.templateElement[this.record].winner_id =
            templateAll.win_site.user_sign_id;
          this.templateElement[this.record].decisive = 1;
          this.templateElement[this.record].name_a = templateAll.name_a;
          this.templateElement[this.record].name_b = templateAll.name_b;
          this.confirmWinnerDialog = false;
        }
      },
      checkedScore(score) {
        let arr = [];
        for (let i = 0; i < score.length; i++) {
          arr.push(score[i].bot, score[i].top);
        }
        for (var i = 0; i < arr.length; i++) {
          if (arr[i] != "") {
            return true;
          }
        }
        return false;
      },
      addTeamInfo(index) {
        if (
          this.templateElement[index].winner != 1 &&
          this.templateElement[index].winner != 0
        ) {
          this.$message({
            type: "warning",
            message: "请选择本场胜负"
          });
        } else {
          this.winner = -1;
          this.winnerRadio = -1;
          this.giveUpReason = -1;
          this.giveUper = -1;
          // 					this.element.decisive = 0
          // 					this.element.winner = -1
          let arr = JSON.parse(JSON.stringify(this.element));
          arr.decisive = 0;
          arr.winner = -1;
          arr.id = null;
          this.dialogElement.name_a = localStorage.getItem("name_a");
          this.dialogElement.name_b = localStorage.getItem("name_b");
          // 					arr.name_a = this.dialogElement.name_a
          // 					arr.name_b = this.dialogElement.name_b
          arr.name_a = localStorage.getItem("name_a");
          arr.name_b = localStorage.getItem("name_b");
          this.templateElement.push(arr);
          this.index++;
          for (let key in this.templateElement) {
            this.$set(this.checkedteamNameA, key, []);
            this.$set(this.checkedteamNameB, key, []);
          }
        }
      },
      delTemplate(index, id, pid) {
        this.$confirm("确认更正比分？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
            center: true
          })
          .then(() => {
            this.$axios
              .post(
                "TeamOnce/index", {
                  id: id,
                  pid: pid
                }, {
                  headers: {
                    token: window.sessionStorage.getItem("token")
                  }
                }
              )
              .then(res => {
                const {
                  code,
                  data,
                  msg
                } = res.data;
                if (code == 2000) {
                  this.$message({
                    type: "success",
                    message: msg
                  });
                  this.teamDialog = false;
                } else {
                  this.$message({
                    type: "error",
                    message: msg
                  });
                }
              })
              .catch(error => {
                console.log(error);
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "您已取消"
            });
          });
      },
      teamPlayerGiveUp(index, cursor, decisive) {
        this.records = cursor;
        if (decisive == 0) {
          if (
            this.checkedteamNameA[this.index].length == 0 ||
            this.checkedteamNameB[this.index].length == 0
          ) {
            this.$message({
              type: "warning",
              message: "请选择上场人"
            });
          } else if (!this.checkedScore(this.templateElement[cursor].score)) {
            this.$message({
              type: "warning",
              message: "分数输入有误"
            });
          } else {
            this.confirmWinnerBtn(cursor);
            this.confirmWinnerDialog = false;
            this.giveUper = index == 0 ? this.playerAId[0] : this.playerBId[0];
            this.giveUpDialog = true;
          }
        } else {
          this.confirmWinnerBtnTow(cursor);
          this.confirmWinnerDialog = false;
          this.giveUper = index == 0 ? this.playerAId[0] : this.playerBId[0];
          this.giveUpDialog = true;
        }
      },
      confirmPlayerGiveUper(index) {
        this.confirmWinnerStatus = true;
        // this.templateAll = []
        this.templateElement[index].winner =
          this.giveUper == this.playerAId[0] ? 1 : 0; //弃权对立为胜者
        let templateAll = this.teamScoreObg(index);
        this.templateElement[index].winner_id = templateAll.win_site.user_sign_id;
        this.templateElement[index].decisive = 1;
        this.templateElement[this.records].decisive = 1;
        this.templateElement[index].name_a = templateAll.name_a;
        this.templateElement[index].name_b = templateAll.name_b;
        this.templateAll.push(templateAll);
        this.giveUpDialog = false;
      },
      // 取消团体提交分数
      cancelTeamScore() {
        this.winner = -1; //重置胜者
        this.giveUper = 0; //重置弃权
        this.giveUpReason = -1;
        this.teamDialog = false;
        if (this.confirmWinnerStatus) {
          this.$router.go(0);
        }
      },
      // 团体提交分数
      confirmTeamScore() {
        this.teamDialog = false;
        // return
        // if (this.templateElement.length <= this.team_field) {
        this.$axios
          .post(
            "/TeamScore/team_score", {
              com_system: this.dialogElement.com_system,
              platoon_id: this.platoon_id,
              group_id: this.dialogElement.group_id,
              formant: this.dialogElement.formant,
              isno: this.dialogElement.isno,
              com_id: this.$route.query.MatchId,
              team_field: this.team_field,
              team_platoon: this.templateAll
            }, {
              headers: {
                token: window.sessionStorage.getItem("token")
              }
            }
          )
          .then(res => {
            if (res.data.code == 2000) {
              localStorage.setItem("name_a", this.dialogElement.name_a);
              localStorage.setItem("name_b", this.dialogElement.name_b);
              this.dialogElement.status = 3;
              this.platoonGrounds[this.editGroundIndex][
                this.editPlayerIndex
              ].list[0] = this.dialogElement;
              // this.dialogElement.win_site = this.templateAll[this.templateAll.length-1].win_site.user_name
              this.$message({
                type: "success",
                message: "打分成功"
              });
            } else {
              this.$message({
                type: "error",
                message: res.data.msg
              });
            }
            this.templateAll = [];
            this.checkedteamNameA = [];
            this.checkedteamNameB = [];
            this.winner = -1; //重置胜者
            this.giveUper = 0; //重置弃权
            this.giveUpReason = -1;
            // this.$router.go(0)
          });
        // } else {
        // 	this.$message({
        // 		type: 'error',
        // 		message: '打分失败,请勿再添加场次'
        // 	})
        // }
      },
      teamNameAChange(value) {},
      teamNameBChange(value) {},
      confirmWinner() {
        this.innerDialog = false;
        this.winner = this.radioWinner;
      },
      cancelGiveUp() {
        this.giveUpDialog = false;
        this.giveUper = 0;
      },
      confirmGiveUper() {
        this.giveUpDialog = false;
        this.winner = this.giveUper == this.dialogElement.sign_id_a ? 1 : 0; //弃权对立为胜者
      },
      cancelScore() {
        this.outerDialog = false;
        this.winner = -1; //重置胜者
        this.giveUper = 0; //重置弃权
        this.giveUpReason = -1;
      },
      confirmScore() {
        if (this.winner == -1) this.innerDialog = true;
        if (this.winner != -1) {
          let group_id = this.dialogElement.group_id;
          let group_num = 0;
          let uploadObj = {};
          let winner = {};
          let loser = {};
          for (let i in this.platoonInfo) {
            if (group_id == this.platoonInfo[i].project_id) {
              group_num = this.platoonInfo[i].signUp_num;
            }
          }
          let round = Math.ceil(Math.log(group_num) / Math.LN2);
          uploadObj.is_end = 0;
          if (this.dialogElement.wheel == round) uploadObj.is_end = 1;
          if (this.winner == 0) {
            winner.user_name = this.dialogElement.name_a;
            winner.team_name = this.dialogElement.team_name_a;
            winner.user_sign_id = this.dialogElement.sign_id_a;
            winner.user_id = this.dialogElement.user_id_a;
            winner.site = this.dialogElement.site_a;
            winner.seed_num = this.dialogElement.seed_num_a;
            winner.one_limit = this.dialogElement.one_limit_a;
            winner.two_limit = this.dialogElement.two_limit_a;
            winner.three_limit = this.dialogElement.three_limit_a;
            loser.user_name = this.dialogElement.name_b;
            loser.team_name = this.dialogElement.team_name_b;
            loser.user_sign_id = this.dialogElement.sign_id_b;
            loser.user_id = this.dialogElement.user_id_b;
            loser.site = this.dialogElement.site_b;
            loser.seed_num = this.dialogElement.seed_num_b;
            loser.one_limit = this.dialogElement.one_limit_b;
            loser.two_limit = this.dialogElement.two_limit_b;
            loser.three_limit = this.dialogElement.three_limit_b;
          }
          if (this.winner == 1) {
            winner.user_name = this.dialogElement.name_b;
            winner.team_name = this.dialogElement.team_name_b;
            winner.user_sign_id = this.dialogElement.sign_id_b;
            winner.user_id = this.dialogElement.user_id_b;
            winner.site = this.dialogElement.site_b;
            winner.seed_num = this.dialogElement.seed_num_b;
            winner.one_limit = this.dialogElement.one_limit_b;
            winner.two_limit = this.dialogElement.two_limit_b;
            winner.three_limit = this.dialogElement.three_limit_b;
            loser.user_name = this.dialogElement.name_a;
            loser.team_name = this.dialogElement.team_name_a;
            loser.user_sign_id = this.dialogElement.sign_id_a;
            loser.user_id = this.dialogElement.user_id_a;
            loser.site = this.dialogElement.site_a;
            loser.seed_num = this.dialogElement.seed_num_a;
            loser.one_limit = this.dialogElement.one_limit_a;
            loser.two_limit = this.dialogElement.two_limit_a;
            loser.three_limit = this.dialogElement.three_limit_a;
          }
          uploadObj[0] = winner;
          uploadObj[1] = loser;
          uploadObj.waiver = {};
          uploadObj.waiver = {
            waiver_user: this.giveUper,
            waiver_cause: this.giveUpReason
          };
          uploadObj.second_order = this.dialogElement.second_order;
          uploadObj.score = this.dialogElement.score;
          uploadObj.note = this.dialogElement.note;
          uploadObj.stage = this.dialogElement.stage;
          uploadObj.wheel = this.dialogElement.wheel;
          uploadObj.field = this.dialogElement.field;
          uploadObj.group_id = this.dialogElement.group_id;
          uploadObj.com_id = this.$route.query.MatchId;
          uploadObj.match_time = this.match_time;
          uploadObj.referee_id = this.dialogElement.refreeSearch ?
            this.dialogElement.refreeSearch :
            "";
          //问超群
          let fomant = 0;
          switch (this.dialogElement.com_system) {
            case 1:
              fomant = 4;
              break;
            case 2:
              fomant = 2;
              break;
            case 4:
              fomant = 3;
              break;
            case 5:
              fomant = 5;
              break;
            case 6:
              fomant = 6;
              break;
          }
          uploadObj.fomant = fomant;
          uploadObj.is_group = this.dialogElement.isno; //is_group为1的时候是同名次打分，为2是决出1-8名打分
          // return
          if (!this.inputScoreCheck(uploadObj)) {
            this.winner = -1; //重置胜者
            this.giveUper = 0; //重置弃权
            this.giveUpReason = -1;
            this.$message({
              type: "error",
              message: "分数输入有误(请输入0-99数字)"
            });
          } else {
            this.$axios
              .post("LineWar/next_round_list", uploadObj, {
                headers: {
                  token: window.sessionStorage.getItem("token")
                }
              })
              .then(res => {
                if (res.data.code == 2001) {
                  this.outerDialog = false;
                  this.dialogElement.status = 2;
                  this.dialogElement.win_site = uploadObj[0].user_name;
                  this.platoonGrounds[this.editGroundIndex][
                    this.editPlayerIndex
                  ].list[0] = this.dialogElement;
                  this.$message({
                    type: "success",
                    message: "打分成功"
                  });
                } else {
                  this.$message({
                    type: "error",
                    message: "打分失败"
                  });
                }
                this.winner = -1; //重置胜者
                this.giveUper = 0; //重置弃权
                this.giveUpReason = -1;
              });
          }
        }
      },
      goback() {
        this.$router.go(-1);
      },
      //发布战表
      toRelease() {
        this.$confirm("确认发布？", "提示", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning",
            center: true
          })
          .then(() => {
            this.loading = true;
            this.$axios
              .post(
                "platoon/table_release", {
                  com_id: this.$route.query.MatchId,
                  match_date: this.date,
                }, {
                  headers: {
                    token: window.sessionStorage.getItem("token")
                  }
                }
              )
              .then(res => {
                if (res.data.code == 2000) {
                  this.initialization("");
                  this.$message({
                    type: "success",
                    message: "发布成功"
                  });
                } else {
                  this.$message({
                    type: "error",
                    message: "发布失败"
                  });
                }
              });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "您已取消"
            });
          });
      },
      goLayoutResult() {
        this.$router.push({
          path: "/index/match/layoutResult",
          query: {
            MatchId: this.$route.query.MatchId
          }
        });
      },
      remoteMethod(query) {
        if (query !== "") {
          this.$axios
            .get("/platoon/search_refree", {
              params: {
                search: query,
                com_id: this.$route.query.MatchId
              },
              headers: {
                token: window.sessionStorage.getItem("token")
              }
            })
            .then(res => {
              this.refreeOption = res.data.data;
            });
        }
      },
      inputScoreCheck(element) {
        for (let index in element.score) {
          let bot = element.score[index].bot;
          let top = element.score[index].top;
          let tiebreak = element.score[index].tiebreak;
          if (bot == "" || (parseInt(bot) > -1 && parseInt(bot) < 100)) {} else {
            return false;
          }
          if (top == "" || (parseInt(top) > -1 && parseInt(top) < 100)) {} else {
            return false;
          }
          if (
            tiebreak == "" ||
            (parseInt(tiebreak) > -1 && parseInt(tiebreak) < 100)
          ) {} else {
            return false;
          }
        }
        return true;
      },
      handleInput(score, index, type) {
        //type top bot tiebreak
        if (this.dialogElement.score[index][type].length > 0) {
          let string = this.dialogElement.score[index][type].replace(
            /[^0-9]/g,
            ""
          );
          this.$set(this.dialogElement.score[index], type, parseInt(string));
        } else {}
      },
      //弃权
      giveUp(index) {
        this.giveUper =
          index == 0 ?
          this.dialogElement.sign_id_a :
          this.dialogElement.sign_id_b;
        this.giveUpDialog = true;
      }
    }
  };
</script>
<style lang="less" scoped>
	// 表格滚动条样式
	/deep/ .is-horizontal{
		height: 13px!important;
	}
	/deep/ .is-horizontal .el-scrollbar__thumb{
		// width: 50%;
		background: rgba(144,147,153,.5)!important;
	}
	/deep/ .el-scrollbar__wrap{
		overflow: scroll!important;
	}
  .customColor {
    position: absolute;
    right: -15px;
    bottom: -15px;
    width: 30px;
    height: 30px;
    transform: rotate(45deg);
  }

  .winner {
    color: #65b500;
  }

  .red {
    color: #c42121;
  }

  .loser {
    color: #ea2000;
  }

  .publishBattleBox {
    background: #f0fbf6;
    color: #666;
  }

  .project-bg {
    background: #303133;
  }

  .scoreAll {
    padding: 20px;

    .basicInfo {
      background: linear-gradient(90deg,
        rgba(66, 185, 131, 0.2),
        rgba(66, 185, 131, 0.4));
      border-radius: 2px;
      line-height: 30px;
      height: 30px;
      padding: 15px;
      overflow: hidden;
      display: flex;
      justify-content: space-around;
      align-items: center;

      span {
        margin-right: 20px;
      }

      .countScene {
        margin-right: 0;
      }

      .btnGroup {
        margin-right: 20px;
      }

      .date {
        width: 20%;
        padding: 10px 15px;
      }
    }

    .tableBox {
      margin-top: 10px;
      padding-bottom: 10px;

      .group {
        height: 40px;
        background-color: #f5f7fa;
        border-bottom: #727272;

        li {
          float: left;
          cursor: pointer;
          height: 40px;
          line-height: 40px;
          text-align: center;
          color: #727272;
          padding: 0 10px;
        }

        li:first-child {
          border-right: 1px solid #eaeaea;
          border-bottom: 0;
          background-color: #fff;
          color: #409eff;
        }

        li:hover {
          color: #409eff;
        }

        .hasClick {
          background-color: #409eff;
          color: #fff;
        }
      }

      .tableMain {
        margin-top: 20px;
        height: 780px;
        width: 100%;

        .table1 {
          margin-top: 10px;
          width: 101%;
          text-align: center;
          border-collapse: collapse;
          border-left: 1px solid #eaeaea;
          border-top: 1px solid #eaeaea;

          thead {
            tr {
              height: 30px;
              background-color: rgba(66, 185, 131, 0.2);

              td {
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
              }
            }
          }

          tbody {
            tr {
              height: 40px;

              .projectBtn:hover {
                transition: 0.5s;
                background: #afd6ff;
                color: #666666;
              }

              .projectBtnSelect {
                background: #409eff;
                color: #ffffff;
              }

              td {
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
                transition: all 0.2s ease-out;
              }

              td:hover {
                transition: 0.5s;
                background: #afd6ff;
                color: #666666;
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
              }

              td:active {
                transition: 0.5s;
                background: #67b2ff;
                color: #fff;
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
              }

              td:first-child {
                width: 10%;
              }

              td:nth-child(2) {
                width: 10%;
              }
            }
          }
        }

        .panel__body--list {
          width: 100%;
          height: 50px;

          .panel__body--item {
            height: 40px;
            border: 1px solid #eaeaea;
            box-shadow: 0px 3px 4px #eaeaea;
            float: left;
            line-height: 40px;
            text-align: center;
            color: #409eff;
            padding: 0 5px;
            margin-right: 10px;
          }

          .sortable-drag {
            height: 40px;
            border: 1px solid #eaeaea;
            box-shadow: 0px 3px 4px #eaeaea;
            float: left;
            line-height: 40px;
            text-align: center;
            background: #409eff;
            color: #fff;
            padding: 0 5px;
          }
        }

        .field {
          box-shadow: 7px 0px 13px 2px #9999;
          margin-top: 10px;
          width: 100%;
          height: 100px;
          text-align: center;
          border-collapse: collapse;
          border-left: 1px solid #eaeaea;
          border-top: 1px solid #eaeaea;
          margin-bottom: 50px;
          position: relative;
          table-layout: fixed;

          .morebox {
            position: absolute;
            height: 5px;
            width: 100%;
            background-color: #eaeaea;
            transition: all 0.5s;

            .more {
              position: absolute;
              bottom: -13px;
              height: 30px;
              background-color: #eaeaea;
              border-radius: 15px;
              width: 30px;
              line-height: 30px;
              color: #fff;
              left: 50%;
              margin-left: -15px;
              transition: all 0.5s;
            }
          }

          .morebox:hover {
            .more {
              background-color: #727272;
            }

            cursor: pointer;
            background-color: #727272;
          }

          thead {
            tr {
              height: 40px;
              background-color: rgba(66, 185, 131, 0.2);

              td {
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
                width: 164px;
              }

              td:first-child {
                width: 63px;
                overflow: hidden;
              }
            }
          }

          tbody {
            tr {
              width: 100%;
              height: 130px;

              td {
                width: 163px;
                vertical-align: top;
                border-right: 1px solid #eaeaea;
                border-bottom: 1px solid #eaeaea;
                box-sizing: border-box;

                .panel__body--list--playground {
                  width: 100%;
                  height: 160px;
                  overflow: hidden;

                  .panel__body--item--playground {
                    height: 156px;
                    width: 100%;
                    border: 1px solid #eaeaea;
                    box-shadow: 0px 3px 4px #eaeaea;
                    float: left;
                    text-align: center;
                    color: #409eff;

                    .battleBox {
                      display: flex;
                      flex-direction: column;
                      height: 100%;

                      .playerName {
                        display: flex;
                        flex-direction: column;
                        justify-content: space-between;
                        height: 90px;
                        overflow: hidden;
                        white-space: nowrap;

                        .vsGround {
                          text-align: left;
                          margin: 0 15%;
                          height: 36px;
                          display: flex;
                          align-items: center;
                          border-bottom: 1px dashed rgba(102, 102, 102, 0.4);
                          border-top: 1px dashed rgba(102, 102, 102, 0.4);

                          .VS {
                            height: 100%;
                            border-right: 1px dashed #6666;
                            line-height: 36px;
                            padding-right: 6%;
                            padding-left: 4%;
                          }

                          .numBox {
                            flex: 1;
                            height: 100%;
                            border-right: 1px dashed #6666;
                            text-align: center;

                            /*max-width: 36px;*/
                            .numTop {
                              height: 50%;
                              border-bottom: 1px dashed #6666;
                            }
                          }
                        }
                      }

                      .playerInfo {
                        display: flex;
                        flex-direction: column;
                        justify-content: space-around;
                        height: 60px;
                        font-size: 12px;
                      }
                    }
                  }

                  .sortable-drag--playground {
                    border: 1px solid #eaeaea;
                    box-shadow: 0px 3px 4px #eaeaea;
                    width: 100%;
                    height: 160px;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    overflow: hidden;
                    text-align: center;
                    background: #409eff;
                    color: #fff;
                    padding: 0 5px;
                  }
                }
              }
            }
          }
        }
      }
    }

    .dialog {
      margin-top: 5%;
      min-width: 520px;

      .battleBox {
        display: flex;
        flex-direction: column;
        height: 100%;

        .playerName {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          height: 110px;

          .vsGround {
            text-align: left;
            height: 56px;
            display: flex;
            align-items: center;
            border-bottom: 1px dashed rgba(102, 102, 102, 0.4);
            border-top: 1px dashed rgba(102, 102, 102, 0.4);

            .VS {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
              font-size: 13px;
              height: 100%;
              white-space: nowrap;
              overflow: hidden;
              text-align: center;
            }

            .numBox {
              flex: 1;
              height: 100%;
              border-right: 1px dashed #6666;
              text-align: center;
              max-width: 100px;

              .numTop {
                height: 50%;
                border-bottom: 1px dashed #6666;
              }
            }
          }
        }

        .playerInfo {
          display: flex;
          flex-direction: row;
          justify-content: space-around;
          height: 40px;
          font-size: 14px;
          margin: 0 10%;
        }
      }

      .btnGroup {
        display: flex;
        flex-direction: column;
        height: 50%;
      }
    }
  }

  @header_background_color: rgba(66, 185, 131, 0.2);
  @header_text_color: #000;
  @alternate_row_background_color: #ddd;

  @table_width: 100%;
  @table_body_height: 750px;
  @column_one_width: 50px;
  @column_two_width: 164px;
  @column_three_width: 350px;

  .tableScorll,.tableScorll-ac {
    min-height: 700px;
    min-width: 80%;
    overflow-x: scroll;
  }
	.tableScorll-ac{
		width: 50vw!important;
	}

  .fixed_headers {
    table-layout: fixed;
    border-collapse: collapse;
		// overflow-x: scroll;
    thead {
      background-color: @header_background_color;
      color: @header_text_color;
      tr {
        display: block;
        position: relative;
        th,
        td {
          padding: 5px 0;
          min-width: 163px;
          border-right: 1px solid #eaeaea;
        }
        td:nth-child(1),
        th:nth-child(1) {
          min-width: @column_one_width;
        }
      }
    }
    tbody {
      display: block;
      overflow: auto;
      height: @table_body_height;
      th,
      td {
        min-width: @column_two_width;
        .panel__body--list--playground {
          width: 163px;
          height: 165px;
          overflow: hidden;
          border-right: 1px solid #eaeaea;
          border-bottom: 1px solid #eaeaea;
          .panel__body--item--playground {
            height: 165px;
            width: 100%;
            box-shadow: 0px 2px 2px #eaeaea;
            float: left;
            text-align: center;
            color: #409eff;
            .battleBox {
              display: flex;
              flex-direction: column;
              height: 100%;

              .playerName {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                height: 72px; //150 - 28 - 90 - 50
                overflow: hidden;
                white-space: nowrap;

                .vsGround {
                  text-align: left;
                  margin: 0 15%;
                  height: 36px;
                  display: flex;
                  align-items: center;
                  border-bottom: 1px dashed rgba(102, 102, 102, 0.4);
                  border-top: 1px dashed rgba(102, 102, 102, 0.4);

                  .VS {
                    height: 100%;
                    border-right: 1px dashed #6666;
                    line-height: 36px;
                    padding-right: 6%;
                    padding-left: 4%;
                  }

                  .numBox {
                    flex: 1;
                    height: 100%;
                    border-right: 1px dashed #6666;
                    text-align: center;

                    .numTop {
                      height: 50%;
                      border-bottom: 1px dashed #6666;
                    }
                  }
                }
              }

              .playerInfo {
                display: flex;
                flex-direction: column;
                justify-content: space-around;
                height: 65px;
                font-size: 12px;
              }
            }
          }

          .sortable-drag--playground {
            border: 1px solid #eaeaea;
            box-shadow: 0px 3px 4px #eaeaea;
            width: 100%;
            height: 150px;
            display: flex;
            flex-direction: column;
            align-items: center;
            overflow: hidden;
            text-align: center;
            background: #409eff;
            color: #fff;
            padding: 0 5px;
          }
        }
      }

      td:nth-child(1),
      th:nth-child(1) {
        min-width: @column_one_width;
        height: 49px;
        position: relative;
        border-right: 1px solid #eaeaea;

        .groundIndex {
          width: 49px;
          height: 149px;
          overflow: hidden;
          line-height: 149px;
        }
      }
    }
  }

  .old_ie_wrapper {
    height: @table_body_height;
    width: @table_width;
    overflow-x: hidden;
    overflow-y: auto;

    tbody {
      height: auto;
    }
  }
</style>
